import 'package:common_utils/common_utils.dart';
import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBEngineer/YBBaseMarQuee/ace_marquee.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBEngineer/YBBaseRouter/YBApplication.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBColor/YBColor.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBImageStyle/YBImageStyle.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBTextStyle/YBTextStyle.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/yb_chinese_text/yb_chinese_text.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBModule/YBWorkTaiModule/YBFenXiangHuKePage/YBBaseProvider/YBBaseProvider.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBUtils/YBBaseUtils/YBCallPhoneUtils.dart';

class YBWorkTaiFSubPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
        height: ScreenUtil.getInstance().getAdapterSize(170),
        child: Column(
          children: [
            Container(
              child: InkWell(
                child: Image.asset(YBImageStyle.getImagePath("homePagequdao"),fit: BoxFit.fitWidth,height: YBTextStyle.adapterSize100,),
                onTap:(){
                  YBCallPhoneUtils().getCallPhoneUtils("tel:4008260189");
                },
              ),
            ),
            Container(
              height:YBTextStyle.adapterSize10,
            ),
            Container(
              decoration:  BoxDecoration(
                border: Border.all(color:YBColor.white,width: 1),
                borderRadius: BorderRadius.circular(YBTextStyle.adapterSize8),
                color: YBColor.white,
              ),
              height: YBTextStyle.adapterSize45,
              child: Row(
                children: [
                  Container(
                    child: Padding(
                        padding:EdgeInsets.only(left: YBTextStyle.adapterSize12),
                        child: Text(YBChineseText.workTaiGongGaoTitle,style: YBTextStyle.workTaiGongGaoText,),
                    ),
                  ),
                  Expanded(
                      child:ChangeNotifierProvider(
                        create: (context) => YBBaseProvider()..getReMenDataList(1, "ybapp_ptgg"),
                        child: Consumer<YBBaseProvider>(
                            builder: (context,gonggaoList,child){
                              if (!ObjectUtil.isEmptyList(gonggaoList.reMenModelList)){
                                if (gonggaoList.reMenModelList.length > 0){
                                  return InkWell(
                                    child: Container(
                                      height: YBTextStyle.adapterSize44,
                                      child: ACEMarquee(
                                        children: gonggaoList.reMenModelList.map((e){
                                          return Container(
                                            alignment: Alignment.centerLeft,
                                            child: Padding(
                                              padding: EdgeInsets.only(left:YBTextStyle.adapterSize10,right:YBTextStyle.adapterSize10,bottom:YBTextStyle.adapterSize10,top:YBTextStyle.adapterSize10),
                                              child: Text(e.title,maxLines: 1,),
                                            ),
                                          );
                                        }).toList()??List(),
                                        direction: AxisDirection.up,
                                        duration: Duration(milliseconds: 2000),
                                      ),
                                    ),
                                    onTap: ()=> YBApplication.router.navigateTo(context,'/workTaiPage/workTaiGonggaoPage?type=1'),
                                  );
                                }else{
                                  return Container();
                                }
                              }else{
                                return Container();
                              }
                            }
                        ),
                      ),
                  ),
                  Container(
                    child: Image.asset(YBImageStyle.getImagePath("findIconArrowRight"),width: YBTextStyle.adapterSize6,height: YBTextStyle.adapterSize10,),
                  ),
                  Container(
                    width: YBTextStyle.adapterSize12,
                  )
                ],
              ),
            ),
          ],
        ),
    );
  }

}
